using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SMWJamecl.BusinessEntities;

namespace SMWJamecl.Repository.Mapping
{
    public class AquilerMap : EntityTypeConfiguration<Aquiler>
    {
        public AquilerMap()
        {
            // Primary Key
            this.HasKey(t => t.Id_Alquiler);

            // Properties
            this.Property(t => t.Id_Alquiler)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("Aquiler");
            this.Property(t => t.Id_Alquiler).HasColumnName("Id_Alquiler");
            this.Property(t => t.Id_Cliente).HasColumnName("Id_Cliente");
            this.Property(t => t.fecha_Alquiler).HasColumnName("fecha_Alquiler");
            this.Property(t => t.TotalAlquiler).HasColumnName("TotalAlquiler");

            // Relationships
            this.HasRequired(t => t.Cliente)
                .WithMany(t => t.Aquilers)
                .HasForeignKey(d => d.Id_Cliente);

        }
    }
}
